package com.happystreet.manager
{
	import com.happystreet.GlobalGameConstants;
	import com.happystreet.config.GameConfig;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;

	public class GameManager extends EventDispatcher
	{
		
		public static const CHANGE_GAME_MODE:String = "changeGameMode";
		public static const ACTIVATE_SHOP:String = "activateShop";
		public static const FOCUS_SHOP:String = "focusShop";
		public static const MANAGE_SHOP:String = "manageShop";
		public static const CUSTOMIZE_SHOP:String = "customizeShop";
		public static const ACTIVATE_SHOP_CUSTOMIZATION:String = "activateShopCustomization";
		public static const CUSTOMIZE_STREET:String = "customizeStreet";
		public static const CUSTOMIZATION_REFRESH:String = "refreshCustomizationTool";
		public static const ACTIVATE_ALL_SHOPS:String = "activateShops";
		public static const DEACTIVATE_ALL_SHOPS:String = "deactivateShops";
		public static const ADD_EMPTY_SHOP_LOCATION:String = "addEmptyShopLocation";
		public static const UPGRADE_SHOP:String = "upgradeShop";
		public static const CHANGE_STREET:String = "changeStreet";
		public static const CHANGE_STREET_BACKGROUND:String = "changeBackground";
		public static const STREET_VIEW_MODE:String = "streetMode";
		public static const SHOP_VIEW_MODE:String = "shopMode";
		public static const CUSTOMIZE_VIEW_MODE:String = "fixedMode";
		public static const RUSH_VIEW_MODE:String = "rushMode";
		public static const REMOVE_SHOP_ACTIONS:String = "removeShopActions";
		public static const CAMERA_VIEW_MODE:String = "cameraViewMode";
		public static const VOTE_VIEW_MODE:String = "voteViewMode";
		public static const DISPLAY_POPUP:String = "displayPopup";
		public static const REMOVE_POPUP:String = "removePopup";
		public static const REMOVE_STACK_POPUP:String = "removeStackPopup";
		public static const REMOTE_REMOVE_POPUP:String = "remoteRemovePopup";
		
		public static var instance:GameManager;
		public function GameManager(value:Singel)
		{
			
		}
		
		public static function getInstance():GameManager
		{
			if(instance==null)
			{
				instance = new GameManager(new Singel());
			}
			
			return instance
		}
		/**
		 *变更游戏模式 
		 * @param mode
		 * 
		 */		
		public function changeGameMode(mode:String):void
		{
			GameConfig.previousGameMode = GameConfig.gameMode;
			GameConfig.gameMode = mode;
			
			switch(GameConfig.gameMode){
				case GlobalGameConstants.VISIT_STREET_GAMEMODE:
					break;
				case GlobalGameConstants.HOME_STREET_GAMEMODE:
					if(GameConfig.previousGameMode==GlobalGameConstants.VISIT_STREET_GAMEMODE||GameConfig.previousGameMode==GlobalGameConstants.VOTE_GAMEMODE){
						StreetManager.instance.changeStreet();
					}
					this.dispatchEvent(new Event(STREET_VIEW_MODE));
					break;
				case GlobalGameConstants.SHOP_INFO_GAMEMODE:
					break;
				case GlobalGameConstants.CUSTOMIZATION_GAMEMODE:
					break;
				case GlobalGameConstants.RUSH_HOUR_GAMEMODE:
					break;
				case GlobalGameConstants.CAMERA_GAMEMODE:
					break;
				case GlobalGameConstants.VOTE_GAMEMODE:
					break;
			}
			
			dispatchEvent(new Event(GameConfig.gameMode));
		}
	}
}
class Singel {
	
}